package com.easyattendance.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="tbl_Class_User")
public class ClassUser {
	
		@Id
		@GenericGenerator(name="class_id",strategy="foreign")
		@Column(name="class_id",length=15,nullable=false)
		private String class_id; 
		
		@Column(name="email_id",length=50,nullable=false,unique=true)
		private String email_id;
		
		@Column(name="password",length=100,nullable=false)
		private String password;
		
		/* one to one mapping */
		
		@OneToOne(optional=false,fetch=FetchType.EAGER)
		@PrimaryKeyJoinColumn
		private Class classObj;

		public String getClass_id() {
			return class_id;
		}

		public void setClass_id(String class_id) {
			this.class_id = class_id;
		}

		public String getEmail_id() {
			return email_id;
		}

		public void setEmail_id(String email_id) {
			this.email_id = email_id;
		}

		public String getPassword() {
			return password;
		}

		public void setPassword(String password) {
			this.password = password;
		}
		
		public Class getClassObj() {
			return classObj;
		}

		public void setClassObj(Class classObj) {
			this.classObj = classObj;
		}

		public ClassUser()
		{
			
		}

		public ClassUser(String class_id, String email_id, String password) {
			super();
			this.class_id = class_id;
			this.email_id = email_id;
			this.password = password;
		}

		public ClassUser(String class_id) {
			super();
			this.class_id = class_id;
		}
		
		
		
	

}
